import { createApp } from "vue";
import App from "./App.vue";

// iconfont css
import "@/assets/iconfont/iconfont.css";
// reset style sheet
import "./styles/reset.css";
// CSS common style sheet
import "./styles/common.scss";
// custom element css
import './styles/element.scss';
// custom element dark css
import './styles/element-dark.scss';
// element dark css
import "element-plus/theme-chalk/dark/css-vars.css";
// element css
import "element-plus/dist/index.css";
// custom directives
import directives from "@/directives/index";
// vue i18n
import I18n from "@/languages/index";

import prototype_util from "./utils/prototype";
console.log("prototype_util:", prototype_util);

import router from "./router";
import pinia from "./store";
import * as Icons from "@element-plus/icons-vue";

// 此处导入是为了解决element-plus的autoimport和component-is的问题  需要修改 具体使用在searchParamItem
import { ElCascader, ElDatePicker, ElInput, ElInputNumber, ElSelect, ElSelectV2, ElSlider, ElTimePicker, ElTimeSelect, ElTreeSelect } from 'element-plus'
const components = [
  ElInput,
  ElInputNumber,
  ElSelect,
  ElSelectV2,
  ElTreeSelect,
  ElCascader,
  ElDatePicker,
  ElTimePicker,
  ElTimeSelect,
  ElSlider
]

const app = createApp(App);

for (const cpn of components) {
  app.component(cpn.name, cpn)
}

Object.keys(Icons).forEach((key) => {
  app.component(key, Icons[key as keyof typeof Icons]);
});


app.use(router);
app.use(pinia);
app.use(directives);
app.use(I18n);
app.mount("#app");
